<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let intersection = (nums1,nums2) => {
     let arr = [];
     for (var i = 0; i < nums1.length; i++) {
         for (var j = 0; j < nums2.length; j++) {
             if (nums1[i] === nums2[j]) {
                 arr.push(nums1[i]);
             };
         };
     };
     return [...new Set(arr)];
 }
 console.log(intersection([1,2,3,4,5,6,4,21,1],[,86,1,4,3,2,2,4,6]))
 
  </script>
</body>
</html>